<%-- 
    Document   : Tray
    Created on : 22.sep.2009, 19:39:58
    Author     : Administrator
--%>

<%@page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>

<fmt:setBundle basename="com.midnightcookies.Midnight" var="bundle" scope="page"/>
<h3><fmt:message key="cookies" bundle="${bundle}"/></h3>

<table border="1">
    <tr>
        <th halign="center">#</th>
        <th align="left">
            <fmt:message key="name" bundle="${bundle}"/>
        </th>
        <th align="left">
            <fmt:message key="value" bundle="${bundle}"/>
        </th>
    </tr>
    <%-- We have to use expression to get at an array.
         If we use ${cookie} then we get a map and
         the entries are not automatically cast --%>
    <% request.setAttribute("cookies", request.getCookies());%>
    <c:set var="i" value="0"/>

    <c:forEach var="ck" items="${cookies}">
        <c:set var="i" value="${i+1}"/>
        <tr>
            <td><c:out value="${i}"/></td>
            <td><c:out value="${ck.name}"/></td>
            <td><c:out value="${ck.value}"/></td>
        </tr>
    </c:forEach>
</table>
